package com.authorization.authcode.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/res")
public class TController{


    @RequestMapping(value="/rec1", method=RequestMethod.GET)
    public String resource1() {
        return "resource1 !";
    }

    @PreAuthorize("hasRole('ROLE_guest')")
    @RequestMapping(value="/rec2", method=RequestMethod.GET)
    public String resource2() {
        return "resource2 !";
    }

}